package com.itheima.config;

import com.itheima.interceptor.TokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @author YangJiaHao
 */
@Configuration
public class WebConfig extends WebMvcConfigurationSupport {
    @Autowired
    private TokenInterceptor tokenInterceptor;

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
                //添加哪个拦截器
        registry.addInterceptor(tokenInterceptor)
                //过滤哪些路径
                .addPathPatterns("/**")
                //放行哪些路径
                .excludePathPatterns("/user/sendMsg","/user/login");
    }
}
